package pl.edu.pjwstk.kor.project4;

import pl.wcislo.sbql4j.db4o.Db4oSBQLQuery;
import com.db4o.ObjectContainer;
import pl.edu.pjwstk.kor.database.Database;
import pl.edu.pjwstk.kor.database.Sbql4jQuery;
import pl.edu.pjwstk.kor.model.Employee;
import java.util.Collection;

/**
 * close by, kwantyfikatory all, any, order by
 */
public class Project4Query implements Sbql4jQuery {
    
    public Project4Query() {
        super();
    }
    private Database database;
    
    @Override()
    public void setDatabase(Database db) {
        this.database = db;
    }
    
    /**
     * #{ db.((Employee as emp)order by emp.lastName asc) }
     * @return
     */
    public Collection<Employee> query1() {
        ObjectContainer db = database.getObjectContainer();
        Object res = new Project4Query_SbqlQuery0(db).executeQuery();
        return (Collection<Employee>)res;
    }
    
    /**
     * #{ db.( any (Employee as emp) emp.lastName == "Sikora" ) }
     * @return
     */
    public Boolean query2() {
        ObjectContainer db = database.getObjectContainer();
        Object res = new Project4Query_SbqlQuery1(db).executeQuery();
        return (Boolean)res;
    }
    
    /**
     * #{ db.( all (Employee as emp) emp.lastName == "Sikora" ) }
     * Wszyscy pracownicy maj\u0105 na nazwisko sikora?
     * @return
     */
    public Boolean query3() {
        ObjectContainer db = database.getObjectContainer();
        Object res = new Project4Query_SbqlQuery2(db).executeQuery();
        return (Boolean)res;
    }
}